package map.action;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.Icon;

import map.mapeditor.MapEditor;

public abstract class AbstractLayerAction extends AbstractAction {
	protected MapEditor editor;

	protected AbstractLayerAction(MapEditor editor, String name,
			String description) {
		super(name);
		putValue(SHORT_DESCRIPTION, description);
		putValue(ACTION_COMMAND_KEY, name);
		this.editor = editor;
	}

	protected AbstractLayerAction(MapEditor editor, String name,
			String description, Icon icon) {
		this(editor, name, description);
		putValue(SMALL_ICON, icon);
	}

	public final void actionPerformed(ActionEvent e) {
		//Map map = editor.getCurrentMap();
		//Vector<MapLayer> layersBefore = new Vector(map.getLayerVector());
		doPerformAction();
	//	Vector<MapLayer> layersAfter = new Vector(map.getLayerVector());
		// MapLayerStateEdit mapLayerStateEdit =
		// new MapLayerStateEdit(map, layersBefore, layersAfter,
		// e.getActionCommand());
		// editor.getUndoSupport().postEdit(mapLayerStateEdit);
		// TODO
	}

	protected abstract void doPerformAction();
}
